package com.huangpeng.algorithm;

/**
 * @Author hp
 * @Title 分库分表核心代码
 * @Package
 * @Date 2021/9/8 10:58
 * @Description
 * @Version 1.0
 */
/*public class ModStrategyHandle implements ShardStrategy{
    @Override
    public String getShardType() {
        return "mod";
    }
    @Override
    public DataTableName handle(String tableName, String dataSourceKey, int tableShardNum, int dbShardNum, Object shardValue) {
        *//** 计算散到表的值 *//*
        long shard_value = Long.valueOf(shardValue.toString());
        long tablePosition = shard_value % tableShardNum;
        long dbPosition = tablePosition / (tableShardNum / dbShardNum);
        String finalTableName = new StringBuilder().append(tableName).append("_").append(tablePosition).toString();
        String finalDataSourceKey = new StringBuilder().append(dataSourceKey).append(dbPosition).toString();
        return new DataTableName(finalTableName, finalDataSourceKey);
    }
}*/
